package model

import "github.com/tsingshaner/gin/shared"

type Class struct {
	shared.Model
	Name        string    `gorm:"type:varchar(100);not null"`
	Description string    `gorm:"type:text;not null"`
	CourseID    shared.ID `gorm:"index:idx_course;type:bigint;not null"`
	TeacherID   shared.ID `gorm:"index:idx_teacher;type:bigint;not null"`
	Students    []Student `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
}

func (*Class) TableName() string {
	return "classes"
}
